package com.scfire.project

import java.util.Date;

import org.grails.databinding.BindingFormat

import com.scfire.project.Project
import com.scfire.security.Member

/**
 * Copyright 2015 Shudao Info Tech Co. Ltd.  All rights reserved.
 * @author lhzeng
 * @email zenglh@haoshudao.com
 * @date 2015年6月11日 上午10:11:34
 * @version V1.0
 */

class Comment implements Comparable {
	
	//评论内容
	String text
	
	//评论时间
	@BindingFormat('yyyy-MM-dd HH:mm:ss')
	Date   createDate
	
	//隐藏 true:显示； false:隐藏
	boolean display_flag = true;
	int member
	 
	int project
	 
	int donate
	//评论用户和项目
	//static belongsTo = [member:Member,project:Project, donate: Donate]

    static constraints = {
		text nullable:true
		createDate nullable:true
		
		member nullable:true
		project nullable:true
		donate nullable:true
		display_flag nullable:true
    }
	
	public int compareTo(Object o) {
		try{
			createDate.compareTo(o?.createDate)
		}catch(Exception e){
			return 1
		}
	}
}
